package com.ranjiaqi.threadpool;

import java.util.concurrent.Callable;

/**
 * @ClassName SubRunner
 * @Description TODO
 * @Author hp
 * @Date 2021/6/30 18:15
 * @Version 1.0
 **/
public class SubRunner implements Callable<Integer> {
    private int num;

    public SubRunner(int num) {
        this.num = num;
    }


    @Override
    public Integer call() throws Exception {
        Thread.currentThread().setName("线程"+num);
        int sum = 0;
        for (int i = 1; i <= num ; i++) {
            sum += i;
        }
        System.out.println("Thread.currentThread().getName() = " + Thread.currentThread().getName());
        return sum;
    }
}
